const express = require('express')
const router = express.Router()
const indexCtrl = require('../controller/index')
const freshmanCtrl = require('../controller/freshman')
const sophomoreCtrl = require('../controller/sophomore')
const juniorCtrl = require('../controller/junior')
const seniorCtrl = require('../controller/senior')

/**
 * http://localhost:3030/
 */
router.route('/')
  .get(indexCtrl.getTotalNum)
  .post(indexCtrl.invalidReq)
  .put(indexCtrl.invalidReq)
  .delete(indexCtrl.invalidReq)

/**
 * http://localhost:3030/freshman
 */
router.route('/freshman')
.get(freshmanCtrl.getFreshman)
.post(freshmanCtrl.addFreshman)
.put(freshmanCtrl.upFreshman)
.delete(freshmanCtrl.delFreshman)

/**
 * http://localhost:3030/sophomore
 */
router.route('/sophomore')
.get(sophomoreCtrl.getSophomore)
.post(sophomoreCtrl.addSophomore)
.put(sophomoreCtrl.upSophomore)
.delete(sophomoreCtrl.delSophomore)

/**
 * http://localhost:3030/junior
 */
router.route('/junior')
.get(juniorCtrl.getJunior)
.post(juniorCtrl.addJunior)
.put(juniorCtrl.upJunior)
.delete(juniorCtrl.delJunior)

/**
 * http://localhost:3030/senior
 */
router.route('/senior')
.get(seniorCtrl.getSenior)
.post(seniorCtrl.addSenior)
.put(seniorCtrl.upSenior)
.delete(seniorCtrl.delSenior)

module.exports = router